package cn.may.controller;

import cn.may.domain.student.Student;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author mayuanbao
 * @date 2019-06-10 10:04
 */
@RestController
public class LoginController {
    @GetMapping("/login")
    public String login(@RequestParam(value = "name") String name, @RequestParam(value = "pwd") String pwd, HttpServletRequest request) {
        if (("jack").equals(name) && "123456".equals(pwd)) {
            Student student = new Student();
            student.setName(name);
            request.getSession().setAttribute("student", student);
            System.out.println(student);
            return "登录成功";
        }
        return "登录失败";
    }
}
